package org.catlabs.patterns.observer;

import org.catlabs.patterns.observer.observer.CurrentConditionsDisplay;
import org.catlabs.patterns.observer.subject.WeatherData;

public class WeatherStation {

    public static void main(String[] args) {

	WeatherData weatherForChicago = new WeatherData();

	CurrentConditionsDisplay currentConditionsDisplay = new CurrentConditionsDisplay(
		weatherForChicago);
	
	weatherForChicago.setMeasurements(getRandomTemp(), getRandomHumidity(), getRandomPressure());
	weatherForChicago.setMeasurements(getRandomTemp(), getRandomHumidity(), getRandomPressure());
	weatherForChicago.setMeasurements(getRandomTemp(), getRandomHumidity(), getRandomPressure());
	weatherForChicago.setMeasurements(getRandomTemp(), getRandomHumidity(), getRandomPressure());
	weatherForChicago.setMeasurements(getRandomTemp(), getRandomHumidity(), getRandomPressure());

    }

    private static float getRandomTemp() {
	return (float)(Math.random()*45f);
    }

    private static float getRandomHumidity() {
	return (float)(Math.random()*100f);
    }

    private static float getRandomPressure() {
	return (float)(Math.random()*7f);
    }

}
